package com.example.nio.intbuffer;

import java.nio.IntBuffer;

/**
 * @author panghu
 * @version 1.0.0
 * @createTime 2023年08月06日 11:34:00
 * @Description
 */
public class ReadOnlyDemo {

    public static void main(String[] args) {
        IntBuffer buffer = IntBuffer.wrap(new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0});
        IntBuffer readBuffer = buffer.asReadOnlyBuffer();

        System.out.println(readBuffer.isReadOnly());
        System.out.println(readBuffer.get());
        //readBuffer.put(0, 666);
        // 如果能拿到底层的数据，那么就可以直接的改数据了，拿不到德！！
        int[] array = readBuffer.array();
    }
}
